package fons.navigator.ui.choosers;

import java.util.Set;
import java.util.Vector;

import javax.swing.JDialog;
import javax.swing.JList;
import javax.swing.event.ListSelectionListener;

import net.java.dev.designgridlayout.DesignGridLayout;
import fons.model.ontology.Dimension;
import fons.model.ontology.SelectionDefinition;
import fons.model.ontology.language.Named;

@SuppressWarnings("unused")
public class SelectionChooser extends JDialog {
	private static final long serialVersionUID = 1L;

	private final DesignGridLayout layout;
	
	private final Set<SelectionDefinition> availableSelectionDefinitions;
	private final Set<Dimension> currentSelections;
	
	private SelectionChooser (final Set<SelectionDefinition> availableSelectionDefinitions,
							  final Set<Dimension> currentSelections) {
		
		super.setTitle("Auswahl spezifizieren");
		
		this.layout = new DesignGridLayout(this);
		
		this.availableSelectionDefinitions = availableSelectionDefinitions;
		this.currentSelections = currentSelections;
	}

	private <T extends Named> JList createSelectionList (Set<T> collection, ListSelectionListener listener) {
		final Vector<String> chooser = new Vector<String>(collection.size());
		
		for (Named named: collection) {
			chooser.add(named.getName());
		}
		
		final JList list = new JList(chooser);
		list.addListSelectionListener(listener);
		
		return list;
	}
}








